package Cantella::DJabberd::Web::UI::ViewPort::Object;

use Reaction::Class;
use aliased 'Cantella::DJabberd::Web::UI::ViewPort::Field::JID';
use aliased 'Cantella::DJabberd::Web::UI::ViewPort::Field::Collection::Linked'
  => 'LinkedCollection';
use aliased 'Cantella::DJabberd::Web::UI::ViewPort::Field::RelatedObject::Linked'
  => 'LinkedObject';
extends 'Reaction::UI::ViewPort::Object';

sub _build_fields_for_type_Cantella_DJabberd_Types_JID  {
  my ($self, $attr, $args) = @_;  
  $self->_build_simple_field(attribute => $attr, class => JID, %$args);
}

around _build_fields_for_type_Reaction_InterfaceModel_Object => sub {
  $_[0]->(@_[1,2], { class => LinkedObject, %{ $_[3] || {} } })
};

around _build_fields_for_type_Reaction_InterfaceModel_Collection => sub {
  $_[0]->(@_[1,2], { class => LinkedCollection, %{ $_[3] || {} } })
};

__PACKAGE__->meta->make_immutable;

1;
